package 笔试强训;

import java.util.*;

/**
 * @Question 电话号码
 * @Date 2022/11/13 23:32
 * @Solution
 */
public class 电话号码 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n=scanner.nextInt();
        HashSet<StringBuilder> ans = new HashSet<>();
        for(int i=0;i<n;i++) {
            String t = scanner.next();
            int len=t.length();
            //检查合法
            if(len<7) {
                continue;
            }
            int c=0;
            Boolean isAdd=true;
            StringBuilder th = new StringBuilder();
            while(c<len) {
                char g = t.charAt(c);
                if(c<len-1 && g=='-' && t.charAt(c+1)=='-') {
                    isAdd=false;
                    break;
                }
                if(g>=65 && g<=90) {
                    th.append((int)(g-65));
                } else {
                    th.append(g);
                }
                c++;
            }
            if(isAdd==true) {
                ans.add(th);
            }
        }
        StringBuilder[] s = (StringBuilder[])ans.toArray();
        for(StringBuilder d : s) {
            System.out.println(d);
        }
    }
}
